import { APILX } from '@/api/requestLx'

export let goodsColumns = [
  {
    title: '物品编号',
    key: 'serialNumber',
    dataIndex: 'serialNumber',
  },
  {
    title: '物品名称',
    key: 'serialName',
    dataIndex: 'serialName',
    width: '20%',
    // isrequired: true,
    // type: FormTypes.slot,
    // slotName: 'processCodeName',
  },
  {
    title: '规格',
    key: 'serialSpecifications',
    dataIndex: 'serialSpecifications',
    width: '20%',
    // isrequired: true,
    // type: FormTypes.slot,
    // slotName: 'processCodeName',
  },
  {
    title: '物品属性',
    key: 'serialProperties',
    dataIndex: 'serialProperties',
    width: '20%',
    // isrequired: true,
    // type: FormTypes.slot,
    // slotName: 'processCodeName',
  },
  {
    title: '单位',
    key: 'unitName',
    dataIndex: 'unitName',
    width: '20%',
    // isrequired: true,
    // type: FormTypes.slot,
    // slotName: 'processCodeName',
  },
]
export let columns = [
  {
    title: '客户编号',
    width: 180,
    ellipsis: true,
    dataIndex: 'customCode',
    searchIndex: 'customCode',
    scopedSlots: {
      filterDropdown: 'searchDropdown',
      filterIcon: 'searchIcon',
      customRender: 'customCode',
    },
  },
  {
    title: '客户名称',
    width: 180,
    ellipsis: true,
    dataIndex: 'customName',
    searchIndex: 'customName',
    scopedSlots: {
      filterDropdown: 'searchDropdown',
      filterIcon: 'searchIcon',
      customRender: 'customName',
    },
  },
  {
    title: '销售订单数',
    width: 120,
    ellipsis: true,
    searchIndex: 'orderCount',
    dataIndex: 'orderCount',
    scopedSlots: {},
  },
  {
    title: '备注',
    width: 120,
    ellipsis: true,
    searchIndex: 'notes',
    dataIndex: 'notes',
    scopedSlots: {},
  },
  {
    title: '创建时间',
    width: 200,
    ellipsis: true,
    dataIndex: 'createTime',
    searchIndex: 'createTime',
    sorter: true,
    scopedSlots: {
      filterDropdown: 'datePickerNoTime',
    },
  },
  {
    title: '更新时间',
    width: 250,
    ellipsis: true,
    dataIndex: 'updateTime',
    sorter: true,
    searchIndex: 'updateTime',
    scopedSlots: {
      filterDropdown: 'datePickerNoTime',
    },
  },
  {
    title: '创建人',
    dataIndex: 'createByName',
    ellipsis: true,
    width: 180,
    searchIndex: 'createBys',
    scopedSlots: {
      filterDropdown: 'createBy',
      filterIcon: 'selectIcon',
      customRender: 'createByName',
    },
  },
  {
    title: '更新人',
    dataIndex: 'updateByName',
    ellipsis: true,
    width: 180,
    searchIndex: 'updateBys',
    scopedSlots: {
      filterDropdown: 'updateBy',
      filterIcon: 'selectIcon',
      customRender: 'updateByName',
    },
  },
]
export let allColumn = [...columns]

export async function getTypeList() {
  await APILX.warehouseEntryInfoEntryType().then((res) => {
    let newArrApply = res.result.map((item) => {
      return {
        label: item.itemText,
        key: item.itemValue,
      }
    })
    columns[1].options = newArrApply
    allColumn[1].options = newArrApply
  })
}
